home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / AccessibleState.java < prev    next >
Text File  |  1998-06-30  |  12KB  |  317 lines

  1. /*
  2.  * @(#)AccessibleState.java    1.22 98/02/04 
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.accessibility;
  22.  
  23. import java.util.Vector;
  24. import java.util.Locale;
  25. import java.util.MissingResourceException;
  26. import java.util.ResourceBundle;
  27.  
  28. /**
  29.  * <P>Class AccessibleState describes a componets particular state.  The actual
  30.  * state of the component is defined as an AccessibleStateSet, which is a
  31.  * composed set of AccessibleStates.
  32.  * <p>The toDisplayString method allows you to obtain the localized string 
  33.  * for a locale independent key from a predefined ResourceBundle for the 
  34.  * keys defined in this class.
  35.  * <p>The constants in this class present a strongly typed enumeration
  36.  * of common object roles.  A public constructor for this class has been
  37.  * purposely omitted and applications should use one of the constants
  38.  * from this class.  If the constants in this class are not sufficient
  39.  * to describe the role of an object, a subclass should be generated
  40.  * from this class and it should provide constants in a similar manner.
  41.  *
  42.  * @version     1.22 02/04/98 11:13:01
  43.  * @author      Willie Walker
  44.  * @author    Peter Korn
  45.  */
  46. public class AccessibleState extends AccessibleBundle {
  47.  
  48.     // If you add or remove anything from here, make sure you 
  49.     // update AccessibleResourceBundle.java.
  50.  
  51.     /**
  52.      * Indicates a window is currently the active window.  This includes 
  53.      * windows, dialogs, frames, etc.
  54.      * @see AccessibleRole#WINDOW
  55.      * @see AccessibleRole#FRAME
  56.      * @see AccessibleRole#DIALOG
  57.      */
  58.     public static final AccessibleState ACTIVE    
  59.             = new AccessibleState("active");
  60.  
  61.     /**
  62.      * Indicates this object is currently pressed.  This is usually
  63.      * associated with buttons and indicates the user has pressed a
  64.      * mouse button while the pointer was over the button and has
  65.      * not yet released the mouse button.
  66.      * @see AccessibleRole#PUSH_BUTTON
  67.      */
  68.     public static final AccessibleState PRESSED
  69.             = new AccessibleState("pressed");
  70.  
  71.     /**
  72.      * Indicates that the object is armed.  This is usually used on buttons
  73.      * that have been pressed but not yet released, and the mouse pointer
  74.      * is still over the button.
  75.      * @see AccessibleRole#PUSH_BUTTON
  76.      */
  77.     public static final AccessibleState ARMED
  78.             = new AccessibleState("armed");
  79.  
  80.     /**
  81.      * Indicates the current object is busy.  This is usually used on objects
  82.      * such as progress bars, sliders, or scroll bars to indicate they are 
  83.      * in a state of transition.
  84.      * @see AccessibleRole#PROGRESS_BAR
  85.      * @see AccessibleRole#SCROLL_BAR
  86.      * @see AccessibleRole#SLIDER
  87.      */
  88.     public static final AccessibleState BUSY
  89.             = new AccessibleState("busy");
  90.  
  91.     /** 
  92.      * Indicates this object is currently checked.  This is usually used on 
  93.      * objects such as toggle buttons, radio buttons, and check boxes.
  94.      * @see AccessibleRole#TOGGLE_BUTTON
  95.      * @see AccessibleRole#RADIO_BUTTON
  96.      * @see AccessibleRole#CHECK_BOX
  97.      */
  98.     public static final AccessibleState CHECKED
  99.             = new AccessibleState("checked");
  100.  
  101.     /**
  102.      * Indicates the user can change the contents of this object.  This
  103.      * is usually used primarily for objects that allow the user to 
  104.      * enter text.  Other objects, such as scroll bars and sliders, 
  105.      * are automatically editable if they are enabled.
  106.      * @see #ENABLED
  107.      */
  108.     public static final AccessibleState EDITABLE
  109.             = new AccessibleState("editable");
  110.  
  111.     /** 
  112.      * Indicates this object allows progressive disclosure of its children.
  113.      * This is usually used with hierarchical objects such as trees and
  114.      * is often paired with the EXPANDED or COLLAPSED states.
  115.      * @see #EXPANDED
  116.      * @see #COLLAPSED
  117.      * @see AccessibleRole#TREE
  118.      */
  119.     public static final AccessibleState EXPANDABLE
  120.             = new AccessibleState("expandable");
  121.  
  122.     /**
  123.      * Indicates this object is collapsed.  This is usually paired with the
  124.      * EXPANDABLE state and is used on objects that provide progressive
  125.      * disclosure such as trees.
  126.      * @see #EXPANDABLE
  127.      * @see #EXPANDED
  128.      * @see AccessibleRole#TREE
  129.      */
  130.     public static final AccessibleState COLLAPSED
  131.             = new AccessibleState("collapsed");
  132.  
  133.     /**
  134.      * Indicates this object is expanded.  This is usually paired with the
  135.      * EXPANDABLE state and is used on objects that provide progressive
  136.      * disclosure such as trees.
  137.      * @see #EXPANDABLE
  138.      * @see #COLLAPSED
  139.      * @see AccessibleRole#TREE
  140.      */
  141.     public static final AccessibleState EXPANDED
  142.             = new AccessibleState("expanded");
  143.  
  144.     /**
  145.      * Indicates this object is enabled.  The absence of this state from an
  146.      * object's state set indicates this object is not enabled.  An object
  147.      * that is not enabled cannot be manipulated by the user.  In a graphical
  148.      * display, it is usually grayed out.
  149.      */
  150.     public static final AccessibleState ENABLED
  151.             = new AccessibleState("enabled");
  152.  
  153.     /** 
  154.      * Indicates this object can accept keyboard focus, which means all 
  155.      * events resulting from typing on the keyboard will normally be 
  156.      * passed to it when it has focus.
  157.      * @see #FOCUSED
  158.      */
  159.     public static final AccessibleState FOCUSABLE
  160.             = new AccessibleState("focusable");
  161.  
  162.     /**
  163.      * Indicates this object current has the keyboard focus.
  164.      * @see #FOCUSABLE
  165.      */
  166.     public static final AccessibleState FOCUSED
  167.             = new AccessibleState("focused");
  168.  
  169.     /**
  170.      * Indicates this object is minimized and is represented only by an
  171.      * icon.  This is usually only associated with frames and internal
  172.      * frames. 
  173.      * @see AccessibleRole#FRAME
  174.      * @see AccessibleRole#INTERNAL_FRAME
  175.      */
  176.     public static final AccessibleState ICONIFIED
  177.             = new AccessibleState("iconified");
  178.  
  179.     /** 
  180.      * Indicates something must be done with this object before the
  181.      * user can interact with an object in a different window.  This
  182.      * is usually associated only with dialogs. 
  183.      * @see AccessibleRole#DIALOG
  184.      */
  185.     public static final AccessibleState MODAL
  186.             = new AccessibleState("modal");
  187.  
  188.     /** 
  189.      * Indicates this object paints every pixel within its
  190.      * rectangular region. A non-opaque component paints only some of
  191.      * its pixels, allowing the pixels underneath it to "show through".
  192.      * A component that does not fully paint its pixels therefore
  193.      * provides a degree of transparency.
  194.      * @see Accessible#getAccessibleContext
  195.      * @see AccessibleContext#getAccessibleComponent
  196.      * @see AccessibleComponent#getBounds
  197.      */
  198.     public static final AccessibleState OPAQUE
  199.             = new AccessibleState("opaque");
  200.  
  201.     /**
  202.      * Indicates the size of this object is not fixed.
  203.      * @see Accessible#getAccessibleContext
  204.      * @see AccessibleContext#getAccessibleComponent
  205.      * @see AccessibleComponent#getSize
  206.      * @see AccessibleComponent#setSize
  207.      */
  208.     public static final AccessibleState RESIZABLE
  209.             = new AccessibleState("resizable");
  210.  
  211.  
  212.     /**
  213.      * Indicates this object allows more than one of its children to
  214.      * be selected at the same time.
  215.      * @see Accessible#getAccessibleContext
  216.      * @see AccessibleContext#getAccessibleSelection
  217.      * @see AccessibleSelection
  218.      */
  219.     public static final AccessibleState MULTISELECTABLE
  220.             = new AccessibleState("multiselectable");
  221.  
  222.     /**
  223.      * Indicates this object is the child of an object that allows its
  224.      * children to be selected, and that this child is one of those
  225.      * children that can be selected.
  226.      * @see #SELECTED
  227.      * @see Accessible#getAccessibleContext
  228.      * @see AccessibleContext#getAccessibleSelection
  229.      * @see AccessibleSelection
  230.      */
  231.     public static final AccessibleState SELECTABLE
  232.             = new AccessibleState("selectable");
  233.  
  234.     /**
  235.      * Indicates this object is the child of an object that allows its
  236.      * children to be selected, and that this child is one of those
  237.      * children that has been selected.
  238.      * @see #SELECTABLE
  239.      * @see Accessible#getAccessibleContext
  240.      * @see AccessibleContext#getAccessibleSelection
  241.      * @see AccessibleSelection
  242.      */
  243.     public static final AccessibleState SELECTED
  244.             = new AccessibleState("selected");
  245.  
  246.     /**
  247.      * Indicates this object, the object's parent, the object's parent's
  248.      * parent, and so on, are all visible.  Note that this does not 
  249.      * necessarily mean the object is painted on the screen.  It might
  250.      * be occluded by some other showing object.
  251.      * @see #VISIBLE
  252.      */
  253.     public static final AccessibleState SHOWING
  254.             = new AccessibleState("showing");
  255.  
  256.     /**
  257.      * Indicates this object is visible.  Note: this means that the
  258.      * object intends to be visible; however, it may not in fact be
  259.      * showing on the screen because one of the objects that this object
  260.      * is contained by is not visible.
  261.      * @see #SHOWING
  262.      */
  263.     public static final AccessibleState VISIBLE
  264.             = new AccessibleState("visible");
  265.  
  266.     /**
  267.      * Indicates the orientation of this object is vertical.  This is
  268.      * usually associated with objects such as scrollbars, sliders, and
  269.      * progress bars.
  270.      * @see #VERTICAL
  271.      * @see AccessibleRole#SCROLL_BAR
  272.      * @see AccessibleRole#SLIDER
  273.      * @see AccessibleRole#PROGRESS_BAR
  274.      */
  275.     public static final AccessibleState VERTICAL
  276.             = new AccessibleState("vertical");
  277.  
  278.     /**
  279.      * Indicates the orientation of this object is horizontal.  This is
  280.      * usually associated with objects such as scrollbars, sliders, and
  281.      * progress bars.
  282.      * @see #HORIZONTAL
  283.      * @see AccessibleRole#SCROLL_BAR
  284.      * @see AccessibleRole#SLIDER
  285.      * @see AccessibleRole#PROGRESS_BAR
  286.      */
  287.     public static final AccessibleState HORIZONTAL
  288.             = new AccessibleState("horizontal");
  289.  
  290.     /**
  291.      * Indicates this (text) object can contain only a single line of text
  292.      */
  293.     public static final AccessibleState SINGLE_LINE
  294.             = new AccessibleState("singleline");
  295.  
  296.     /**
  297.      * Indicates this (text) object can contain multiple lines of text
  298.      */
  299.     public static final AccessibleState MULTI_LINE
  300.             = new AccessibleState("multiline");
  301.  
  302.     /**
  303.      * Create a new AccessibleState using the given locale independent key.
  304.      * This should not be a public method.  Instead, it is used to create
  305.      * the constants in this file to make it a strongly typed enumeration.
  306.      * Subclasses of this class should enforce similar policy.
  307.      * @param key the locale independent name of the state.
  308.      * @note The String should be a locale independent key for the state.
  309.      * It is not intended to be used as the actual String to display 
  310.      * to the user.  To get the localized string, use toDisplayString.
  311.      * @see AccessibleBundle#toDisplayString
  312.      */
  313.     protected AccessibleState(String key) {
  314.         this.key = key;        
  315.     }
  316. }
  317.